import { GetTypeOf } from "../../../Decorator/Decorator";
import { ITypeBind } from "../../Object/NamedObject";

export interface IInvoke {

    Type: string;

}

export class IInvoke {

}

export class InvokeStruct {

}

export interface InvokeClassConstructor<T> {
    new(): T;
}

export abstract class AInvokeHandler<A> implements IInvoke, ITypeBind {

    private _Type: InvokeClassConstructor<A>;
    constructor() {

    }

    SetupType(type: InvokeClassConstructor<A>) {
        this._Type = type;
    }

    get Type(): string {
        return GetTypeOf(this._Type);
    }

    abstract Handle(a: A): void;

}

export abstract class AInvokeHandler1<A, T> implements IInvoke, ITypeBind {

    private _Type: InvokeClassConstructor<A>;
    constructor() {

    }

    SetupType(type: InvokeClassConstructor<A>) {
        this._Type = type;
    }

    get Type(): string {
        return GetTypeOf(this._Type);
    }

    abstract Handle(a: A): T;

}